<?php



/**
 * Radcodes - SocialEngine Module
 *
 * @category   Application_Extensions
 * @package    Game
 * @copyright  Copyright (c) 2009-2010 Radcodes LLC (http://www.radcodes.com)
 * @license    http://www.radcodes.com/license/
 * @version    $Id$
 * @author     Vincent Van <vincent@radcodes.com>
 */
 
 
 
class Game_Form_Admin_Setting_Category extends Engine_Form
{
  public function init()
  {
    $this
      ->setTitle('Category Mapping')
      ->setDescription('You can map distributor categories to your own category names, so that when importing games from distributors, their categories are assigned to your defined categories.');
    
    $this->addElement('Dummy', 'mapping', array(
      'label' => 'Distributor Categories',
      'description' => 'To be mapped to categories on this site:',
      'ignore' => true,
    ));
      
    $distributorCategories = Game_Model_Category::getDistributorCategories();  
      
    $multiOptions = array("0" => "__ Skip This Category __") + Engine_Api::_()->getItemTable('game_category')->getMultiOptionsAssoc();

    foreach ($distributorCategories as $key => $value) {
      $config = array(
        'label' => $value,
        'multiOptions' => $multiOptions
      );
      
      if ($key == 'uncategorized') {
        $config['description'] = "When a game distributor category would not be identified or mapped, it would be assigned under UNCATEGORIZED. You can discard these games by skipping or assign them under a new category.";
      }
      
      $this->addElement('Select', $key, $config);
    }

    // Add submit button
    $this->addElement('Button', 'submit', array(
      'label' => 'Save Changes',
      'type' => 'submit',
      'ignore' => true
    ));
  }
}